﻿using DocumentFormat.OpenXml.Lite.Helper;
using DocumentFormat.OpenXml.Lite.WordprocessingML.Word.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Word.RunProperties
{
    [XmlRoot("rFonts", Namespace = Constants.WordMain)]
    public class Fonts : XmlSerializable, IRunPropElement
    {
        [Optional]
        [XmlAttribute("hint", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_Hint> Hint { get; set; }

        [Optional]
        [XmlAttribute("ascii", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public string AsciiFont { get; set; }

        [Optional]
        [XmlAttribute("hAnsi", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public string HAnsiFont { get; set; }

        [Optional]
        [XmlAttribute("eastAsia", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public string EastAsiaFont { get; set; }

        [Optional]
        [XmlAttribute("cs", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public string ComplexFont { get; set; }

        [Optional]
        [XmlAttribute("asciiTheme", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_Theme> AsciiTheme { get; set; }

        [Optional]
        [XmlAttribute("hAnsiTheme", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_Theme> HAnsiTheme { get; set; }

        [Optional]
        [XmlAttribute("eastAsiaTheme", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_Theme> EastAsiaTheme { get; set; }

        [Optional]
        [XmlAttribute("cstheme", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_Theme> ComplexTheme { get; set; }

        public Fonts() { }

        public void Copy(object obj)
        {
            if (obj is Fonts)
            {
                this.Hint = (obj as Fonts).Hint;
                this.AsciiFont = (obj as Fonts).AsciiFont;
                this.HAnsiFont = (obj as Fonts).HAnsiFont;
                this.EastAsiaFont = (obj as Fonts).EastAsiaFont;
                this.ComplexFont = (obj as Fonts).ComplexFont;
                this.AsciiTheme = (obj as Fonts).AsciiTheme;
                this.HAnsiTheme = (obj as Fonts).HAnsiTheme;
                this.EastAsiaTheme = (obj as Fonts).EastAsiaTheme;
                this.ComplexTheme = (obj as Fonts).ComplexTheme;
            }
        }
    }
}
